package com.jie.server.modules.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jie.common.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 行政区划
 * @author: xiaojie
 * @since: 2024/12/18 0018
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("jie_area")
public class AreaEntity extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /** 主键id */
    @ApiModelProperty("主键ID")
    @TableId(value = "area_id", type = IdType.AUTO)
    private Long areaId;

    /** 上级区域id */
    private Long parentId;

    /** 名称 */
    private String name;

    /** 区域类型：0 省 1 市 2 区 */
    private Integer type;

    /** 子行政区划 */
    @TableField(exist = false)
    private List<AreaEntity> children = new ArrayList<>();

}
